package org.itv.ftps;

import java.io.File;

import org.apache.ftpserver.ftplet.User;
import org.apache.ftpserver.ftplet.UserManager;
import org.apache.ftpserver.usermanager.Md5PasswordEncryptor;
import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
import org.apache.ftpserver.usermanager.SaltedPasswordEncryptor;
import org.apache.ftpserver.usermanager.UserFactory;

public class Muser {
    public static void main(String[] args) throws Exception {
        PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
        userManagerFactory.setFile(new File("e://temp//myusers.properties"));
//        userManagerFactory.setPasswordEncryptor(new SaltedPasswordEncryptor());
        userManagerFactory.setPasswordEncryptor(new Md5PasswordEncryptor());
        UserManager um = userManagerFactory.createUserManager();

        UserFactory userFact = new UserFactory();
        userFact.setName("cwl");
        userFact.setPassword("123456");
        userFact.setHomeDirectory("ftproot");
        User user = userFact.createUser();
        um.save(user);
    }

}
